timber <- st_read("https://data-cdtfa.opendata.arcgis.com/datasets/7083a55396e84f76956a047ca856d6d1_0.geojson?outSR=%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D")
## Reading layer `CA_Timber_Production_Statistics' from data source `https://data-cdtfa.opendata.arcgis.com/datasets/7083a55396e84f76956a047ca856d6d1_0.geojson?outSR=%7B%22latestWkid%22%3A3857%2C%22wkid%22%3A102100%7D' using driver `GeoJSON'
## Simple feature collection with 348 features and 12 fields
## geometry type: MULTIPOLYGON
## dimension: XY
## bbox: xmin: -124.4151 ymin: 32.53423 xmax: -114.1308 ymax: 42.0095
## geographic CRS: WGS 84
timber <- filter(timber, intCalendarYear == 2017)
timber <- mutate(timber, VolMFeet = intNetVolBoardFeet/1000000)
timber$describe <-
paste(timber$strCounty, "<br>",
prettyNum(timber$VolMFeet), " feet") %>%
lapply(htmltools::HTML)
- Add table with values
- Try a green color palette?
- Make highlight highlight in same c
bins <- c(0,.01, 10, 20, 50, 100, 200, 300)
pal <- colorBin("BuGn", domain = timber$VolMFeet, bins = bins)
timber_map2 <- leaflet(timber,
options = leafletOptions(minZoom = 5, maxZoom = 9)) %>%
addProviderTiles(providers$Stamen.Terrain) %>%
addPolygons(fillColor = ~pal(VolMFeet),fillOpacity = 0.7, stroke = TRUE, weight = 1.5,
highlightOptions = highlightOptions(fillColor = "green",
fillOpacity = 1),
label = timber$FMNAME_PC,
popup = paste( timber$FMNAME_PC, "<br/>",
"Net Board Production:", (timber$VolMFeet),"million feet", "<br/>")) %>%
addControl("2017 Timber Production in California by County", position = "topright") %>%
addControl('<a href="https://gis.data.ca.gov/datasets/7083a55396e84f76956a047ca856d6d1_0/data?geometry=-165.240%2C22.044%2C-51.333%2C46.994">Data Source</a>',
position = "bottomleft") %>%
addLegend(pal = pal,
values = timber$VolMFeet,
title = "Net Board Production (million feet)",
opacity = 1) %>%
setMaxBounds( lng1 = -130,
lat1 = -45,
lng2 = -110,
lat2 = 43)
timber_map2